Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Validate typescript types for modifier data #685

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

marcustyphoon
Copy link
Collaborator

This uses https://github.com/samchon/typia's runtime type validators to confirm that the modifier data files match the types specified for them in src/assets/modifierdata/metadata.ts.

Typia applies a build-time code transformation to convert Typescript's types (which don't exist at runtime) into code. It's possible to integrate this into the Vite build process, but as we don't currently do any runtime validation in the actual application and that involves making sure Vite uses tsc, this instead does a one-time code generation when you run a standalone script. (There is a potential use case for runtime verification—we could validate the user-entered content in the "Extra Modifiers" box—but that could be a potential future thing.)

This is a first step to typing the modifier data as it flows through the codebase; right now it's all any.

Copy link
Contributor

github-actions bot commented Mar 13, 2024

Deployed preview build to Cloudflare!

Last commit: 71f7e26
Preview URL: https://7414f3d5.discretize-optimizer.pages.dev
Branch Preview URL: https://json-schema-typia-2a.discretize-optimizer.pages.dev

@marcustyphoon marcustyphoon merged commit 5fd5e01 into main Mar 13, 2024
3 checks passed
@marcustyphoon marcustyphoon deleted the json-schema-typia-2a branch March 13, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant